﻿using System.Net;

namespace gtasks.Utils
{
    public class HttpUtils
    {
        public static HttpWebRequest CreateRequest(string url, string token = null)
        {
            var req = WebRequest.Create(url) as HttpWebRequest;
            req.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
            if(token != null)
            {
                req.Headers.Add("Authorization: Bearer " + token);
            }
            return req;
        }
    }
}